// 例子19

{
    const fn = x => x + 5;
    // 等同于
    //let fn = function(x) {
    //		return x + 5;
    //}
}

console.log('----------------------------------');

{
    const add = (x, y) => x + y;
    // 等同于
    //let add = function(x, y) {
    //		return x + y;
    //}
}

console.log('----------------------------------');

{
    const divide = (x, y) => {
		if (typeof x === 'number' && typeof y === 'number' && y !== 0 && !isNaN(x) && !isNaN(y)) {
			let result = Math.floor(x / y);
			let mod = x % y;
			return `${x}除以${y}的商为${result}，余数为${mod}。`
		} else {
			return '输入不合法';
		}
    }
    console.log(divide(1, 2)); // "1除以2的商为0，余数为1。"
}

console.log('----------------------------------');

{
    let result = [1, 2, 3].map((value, key) => (`key is ${key} and value is ${value}`)).join('\n');
    console.log(result);
    // "key is 0 and value is 1
    // key is 1 and value is 2
    // key is 2 and value is 3"
}